home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 September / Chip_2003-09_cd2.bin / system / xteq / setup.exe / {app} / plugins / XQ IUnknown OpenWith List.xpl < prev    next >
Encoding:
XSetup plugin  |  2002-11-22  |  3.3 KB  |  95 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 6.0"
  2. "TYPE"="9"
  3. "COUNT"="3"
  4. "UIPATH"="Appearance\Files&Folders\Unknown Files"
  5. "NAME"="Unknown File Open With List"
  6. "VERSION"="1.01"
  7. "LANGUAGE"="VBScript"
  8. "TEXT 1"="n/a"
  9. "DESCRIPTION 1"="Windows "know" which file should be opened by which application by checking the file extension (e.g. TXT = Notepad, DOC = Word etc.). A file with an extension that Windows does not know is called an "Unknown" or "Unregistered" file. If you click on an unknown file anyway, a dialog will pop up. Windows version before XP will display the "Open with..." list so you can select the program that should be used to open that type of file. Since Windows XP, you can select if you want to check the Microsoft.com site or display the "Open with..."."
  10. "DESCRIPTION 2"="This plug-in can be used to select the applications that will appear inside the "Open with..." List. "
  11. "DESCRIPTION 3"="A checkmark beside the program means: "Yes, show this application inside the Open with list"."
  12. "DESCRIPTION 4"="Please note that this list only shows the internal name (e.g. OUTLOOK.EXE) of the program, not the user-friendly name (e.g. "Microsoft Outlook"). If you are unsure which program Windows is refering to, simply use the Start -> Find -> Files or Folders feature to locate the file on your HD and execute it. This way, you will easily see which program Windows is refering to."
  13. "AUTHOR"="Xteq Systems"
  14. "CONTACTURL"="http://www.xteq.com"
  15. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  16. "COMMENT 1"=" "
  17. "COMMENT 2"=" "
  18.  
  19.  
  20.  
  21. sPath="HKLM\SOFTWARE\Classes\Applications\"
  22. sNoOpenWith="NoOpenWith"
  23.  
  24. sUnknownFileCommand="HKLM\SOFTWARE\Classes\Unknown\Shell\Open\Command\@"
  25.  
  26. dim iItems        'contains the total amount of the registry keys
  27. Dim aryItems()    'contains the name of the Registry paths (direct files starting with ".")
  28.  
  29.  
  30. Sub Plugin_Initialize 
  31.  iItems=0
  32.  s=RegReadValue(sUnknownFileCommand)
  33.  
  34.  if len(s)>0 then
  35.     Call MsgError("You have currently configured a command that will be used for any unknown file. This disables the `Open with...` list so this plug-in is disabled as well. Please deactivate the unknown file command by using the `Unknown file command` plug-in if you wish to use this plug-in.")
  36.     Call Disable()
  37.  else
  38.     Call ReadRegistry()
  39.  end if
  40. End Sub
  41.  
  42.  
  43. Sub ReadRegistry
  44.  for l=1 to iItems
  45.      Call SetUIElement(l,"")
  46.  next 
  47.  
  48.  iItems=RegEnumPaths(sPath) 
  49.  ReDim aryItems(iItems)
  50.  
  51.  For l=1 to iItems 
  52.      'save the name
  53.      sName=RegEnumElement(l)
  54.      aryItems(l)=sName
  55.  
  56.      Call SetUIElement(l,sName)
  57.  
  58.      if RegValueExists(sPath & sName & "\" & sNoOpenWith)=false then
  59.         Call SetUIElementEx(l,True)
  60.      end if    
  61.  next
  62.  
  63. End Sub
  64.  
  65.  
  66.  
  67.  
  68. Sub Plugin_Apply(ElementIndex,ElementSubIndex)
  69.  bActivated=false
  70.  sTmpPath=""
  71.  
  72.  for l=1 to iItems
  73.      sName=aryItems(l)
  74.      bActivated=GetUIElementEx(l)
  75.      sTmpPath=sPath & sName & "\" & sNoOpenWith
  76.  
  77.      if bActivated=true then
  78.         if RegValueExists(sTmpPath)=true then
  79.            Call RegDeleteValue(sTmpPath)
  80.         end if
  81.      else
  82.         if RegValueExists(sTmpPath)=false then
  83.            Call RegWriteValue(sTmpPath,"",1)
  84.         end if
  85.      end if           
  86.  next 
  87.  
  88.  Call ReadRegistry()
  89.  
  90. End Sub
  91.  
  92.  
  93. Sub Plugin_Terminate 
  94. End Sub
  95.